#define _CRT_SECURE_NO_WARNINGS
#include"SList.h"
void SLTtest1()
{
	SListNode* plist= NULL;
	SListPushBack(&plist, 4);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 1);

	SListPrint(plist);
	SListPushFront(&plist, 4);
}
void SLTtest2()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 1);
	SListPrint(plist);
	
	SListPopBack(& plist);
	SListPrint(plist);

	SListPopBack(&plist);
	SListPrint(plist);

	SListPopBack(&plist);
	SListPrint(plist);

	SListPopBack(&plist);
	SListPrint(plist);

	

}
void SLTtest3()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 4);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 1);

	SListPrint(plist);
	
	SListPopFront(&plist);
	SListPrint(plist);

	SListPopFront(&plist);
	SListPrint(plist);

	SListPopFront(&plist);
	SListPrint(plist);

	SListPopFront(&plist);
	SListPrint(plist);

}
void SLTtest5()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 4);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 1);

	SListPrint(plist);

	SListNode* ret = SListFind(plist, 1);
	ret->data *= 2;
	SListPrint(plist);

	SListInsertAfter(ret, 0);
	SListPrint(plist);


	/*SListInsertAfter(ret, 4);
	SListPrint(plist);

	SListInsertAfter(ret, 5);
	SListPrint(plist);

	SListEraseAfter(ret);
	SListPrint(plist);

	SListEraseAfter(ret);
	SListPrint(plist);*/


}
void SLTtest6()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 4);
	SListNode* ret = SListFind(plist, 4);
	SListInsert(&plist, ret, 6);

	SListPrint(plist);


	SListInsert(&plist, ret, 5);
	SListPrint(plist);


}
void SLTtest7()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 4);
	SListNode* ret = SListFind(plist, 4);
	SListInsert(&plist, ret, 6);

	SListPrint(plist);


	SListInsert(&plist, ret, 5);
	SListPrint(plist);

	SListErase(& plist, ret);
	ret = NULL;
	SListPrint(plist);



	SListDestroy(&plist);
	SListPrint(plist);



}
int main()
{
	SLTtest7();
	return 0;
}
